/**
 * @author hoang.pt
 * @version $Id: Account.java 124 2010-08-31 08:12:28Z phantichhoang $
 */

package snippet.lab2;

/**
 * Account entity
 * @author hoang.pt
 * @version $Id: Account.java 124 2010-08-31 08:12:28Z phantichhoang $
 */
public class Account {
    /**
     * @var int
     */
    int balance = 1000;

    /**
     * drawing money
     * @author hoang.pt
     * @throws InterruptedException 
     */
    public synchronized void drawMoney(String name, int deposit) throws InterruptedException {
        int y = balance - deposit;
        System.out.println(name+ " is drawing " +deposit);
        
        //print .....
        for (int i=0; i<5; i++ ) {
            Thread.sleep(1000);
            System.out.print(".");
        }

        this.balance = y;
    }

}
